package apiday03homework;

import java.util.ArrayList;
import java.util.Collection;

public class CollectionDemo3 {
    public static void main(String[] args) {
        Collection<String> c1 = new ArrayList<>();
        c1.add("java");
        c1.add("c");
        c1.add("c++");
        c1.add("python");
        System.out.println("c1:"+c1);

        Collection<String> c2 = new ArrayList<>();
        c2.add("java");
        c2.add("c");
        c2.add("php");
        System.out.println("c2:"+c2);

        c1.addAll(c2);
        System.out.println("c1:"+c1);
        System.out.println("c2:"+c2);

        Collection<String> c3 = new ArrayList<>();
        c3.add("java");
        c3.add("c");
        c3.add("php");
        System.out.println("c3:"+c3);

        boolean b = c1.containsAll(c3);
        System.out.println("c1是否包含c3:"+b);
        c1.retainAll(c3);
        System.out.println("c1:"+c1);
        System.out.println("c3:"+c3);
        System.out.println("!!!!!!!");
        c1.removeAll(c3);
        System.out.println("c1:"+c1);
        System.out.println("c3:"+c3);
    }
}
